//根组件
import { defineComponent,h,computed,ref } from "@vue/runtime-core";
//import {render} from "vue";
//import Circle from "./components/Circle";
import StartPage from "./page/StartPage";
import GamePage from "./page/GamePage";

export default defineComponent({
    setup(){
        const currentPageName = ref('GamePage');
        const currentPage = computed(()=>{
            if (currentPageName.value === "StartPage"){
                return StartPage
            }else if(currentPageName.value ==="GamePage"){
                return GamePage
            }
        })
        return{
            currentPageName,
            currentPage
        }
    },
    render(ctx){
        return h('Container',[
            h(ctx.currentPage,{ //通过计算属性返回来的ctx.currentPage赋值改变页面
            onChangePage(page){ //子组件传过来的changePage前面加on首字母大写，pixi框架规定的
                console.log(page);
                ctx.currentPageName = page
            }
            }
            )
        ])

/*        //创建 vnode
       // <rect x=100 y=100>我的头发好少<circle>11</circle></rect>
        const vnode = h("react",{x:100,y:100},
            ["我的头发好少",
            //h('circle',{x:150,y:150},'Je suis circle'),
                h(Circle)
            ]);
        console.log(vnode);
        return vnode*/
    }
})